home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_olv_snaketotem_bridge.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  349 lines

  1. # Jones 3D Cog Script
  2. #
  3. # olv_snaketotem_bridge.cog
  4. #
  5. # Cog to knock over snake totem.
  6. #
  7. # [DS & revised by HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ==============================================================================
  12.  
  13. symbols
  14.  
  15.     message        startup
  16.     message        activated
  17.     message        entered
  18.     message        exited
  19.     message        touched
  20.     message        pulse
  21.  
  22.     keyframe    in_push=in_push_nomove.key                local
  23.     keyframe    in_touch=in_activate_medium_left.key        local
  24.     keyframe    in_push2=in_olv_push_nomove.key            local
  25.  
  26.     sound        pushsnd0=inxj092.wav                    local # when below no go.
  27.     sound        pushsnd1=inxj112.wav                    local # pushing down.
  28.     sound        touchsnd=inxj030.wav                    local # first touched.
  29. #    sound        hitsnd=olv_rockhead_hitearth_c.wav            local
  30.     sound        hitsnd=nub_stonedoor_stop_c.wav            local
  31.     sound        fallsnd=tem_lava_mouth_c.wav                local
  32.     sound        music0=mus_gen_awechord1.wav                local
  33.     thing        totem0
  34.     thing        totem_cam                            nolink
  35.     thing        totem_ct                            nolink
  36.     thing        totem_poscam                        nolink
  37.     thing        inviso_head                            nolink
  38.     sector    temple0
  39.     sector    totemslot
  40.     cog        hints                                # send message when complete
  41.     vector    v_campos                            local
  42.     float        moveSpeed=3.0                        local
  43.     int        curcam                            local
  44.     int        hit                                local    
  45.     int        fall                                local
  46.     int        climbed=0                            local
  47.     int        totemstatus                            local
  48.     int        moveStatus                            local
  49.     int        fallen=0                            local
  50.     int        touched=0                            local
  51.     int        vibe                                local
  52.     int        shake                                local
  53.  
  54.     flex        MoveTotem                Local
  55.     thing        player                local
  56.     int        push                    local
  57.     int        nope                    local
  58.     flex        checkstatus                local
  59.     vector    posoffset                local
  60.     vector    angoffset                local
  61.  
  62.  
  63. end
  64.  
  65. # ------------------------------------------------------------------------------
  66.  
  67. code
  68.  
  69. startup:
  70.  
  71.     player=GetLocalPlayerThing(); 
  72.     SetThingLight(totem0, '0.5 0.5 0.4', 0.01, 0.01);
  73.     return;
  74.  
  75. # ..............................................................................
  76.  
  77. entered:
  78.  
  79.     if (getsenderref() != temple0)
  80.     {
  81.         return;
  82.     }
  83.  
  84.     if (fallen == 1)
  85.     {
  86.         return;
  87.     }
  88.  
  89.     # Print("entered push sector");
  90.  
  91.     climbed = 1;
  92.  
  93.     return;
  94.  
  95. # ..............................................................................
  96.  
  97. exited:
  98.  
  99.     if (getsenderref() != temple0)
  100.     {
  101.         return;
  102.     }
  103.  
  104.     climbed = 0;
  105.  
  106.     # Print("exited push sector");
  107.  
  108.     return;
  109.  
  110. # ..............................................................................
  111.  
  112. touched:
  113.  
  114.     if (fallen == 1)
  115.     {
  116.         return;
  117.     }
  118.     if (touched == 1)
  119.     {
  120.         return;
  121.     }
  122.     touched = 1;
  123.     MakeMeStop();
  124.     DeselectWeaponWait(player);
  125.     PlayKey(player, in_touch, 4, 0x12, 1);
  126.     PlayVoice(player, touchsnd, 1.0, 1);
  127.     ClearActorFlags(player, 0x200000);
  128.     return;
  129.  
  130. # ..............................................................................
  131.  
  132. activated:
  133.  
  134.     if (fallen == 1)
  135.     {
  136.         return;
  137.     }
  138.  
  139.     MakeMeStop();
  140.     DeselectWeaponWait(player);
  141.     StartCutscene(1);
  142.     # Print("totem activated");
  143.     if (climbed == 0)
  144.     {
  145.         push = PlayKey(player, in_push2, 4, 0x12, 1);
  146.         ClearActorFlags(player, 0x200000);
  147.         nope = PlayVoice(player, pushsnd0, 1.0, 1);
  148.         EndCutscene();
  149.         return;
  150.     }
  151.     if (climbed == 1)
  152.     {
  153.         push = PlayKey(player, in_push, 4, 0x12, 0);
  154.         sleep(1.3);
  155.         call CheckStatus;
  156.  
  157.         if (moveStatus)
  158.         {
  159.             return;
  160.         }
  161.  
  162.         if (totemStatus == 0)
  163.         {
  164.             fallen = 1;
  165.             goto MoveTotem;
  166.         }
  167.  
  168.         WaitForStop(push);
  169.         ClearActorFlags(player, 0x200000);
  170.         EndCutscene();
  171.     }
  172.     return;
  173.  
  174. # ..............................................................................
  175.  
  176. MoveTotem:
  177.  
  178.     StartCutScene(1);
  179.     fall=PlaySoundThing(fallsnd, totem0, 1, 10, 20, 1);
  180.     AttachThingToThingEx(totem_ct, totem0, 0x0C);
  181.     rotatepivot(totem0, 1, moveSpeed);
  182.  
  183.  
  184.     # Watch the bridge fall into place...
  185.     curcam = GetCurrentCamera();
  186.     SetCameraLookInterp(2, 0);
  187.     SetCameraPosInterp(2, 0);
  188.     SetCameraFocus(2, totem_cam);
  189.     SetCameraSecondaryFocus(2, totem_ct);
  190.     SetCurrentCamera(2);
  191.     SetCameraFOV(70, 0, 0.0);
  192.     Sleep(0.01);
  193.     SetCameraFOV(90, 1, 3.0);    
  194.     waitforstop(totem0);
  195.     PlaySoundThing(hitsnd, totem0, 1, 10, 20, 0);
  196.     rotate(totem0, 25, 2, 0.4);
  197.     waitforstop(totem0);
  198.     StopSound(fall, 0.01);
  199.     hit = PlaySoundThing(hitsnd, totem0, 1, 10, 20, 0);
  200.     jumptoframe(totem0, 2, totemslot);
  201.     hit = PlaySoundThing(hitsnd, totem0, 1, 10, 20, 0);
  202.  
  203.     # TO DO: camera shake here...
  204.     shake = 2;
  205.     SetPulse(0.1);
  206.     Sleep(0.5);
  207.     shake = 1;
  208.     Sleep(0.5); # at least
  209.     waitforsound(hit);
  210.     SetPulse(0.0);
  211.  
  212.     v_campos = GetThingPOS(totem_poscam); 
  213.     SetCameraPosition(1, v_campos); # prep to swing back to follow-cam
  214.     SetCurrentCamera(curcam);
  215.     ResetCameraFOV(0, 0.0);
  216.     PlaySoundLocal(music0, 0.7, 0.0, 0x0, 0);
  217.     sleep(2.0);
  218.     PlayVoice(player, pushsnd1, 1.0, 0);
  219.     SendMessage(hints, user4);
  220.     DestroyThing(inviso_head);
  221.     EndCutScene();
  222.     ClearActorFlags(player, 0x200000);
  223.  
  224.     return;
  225.  
  226. # ..............................................................................
  227.  
  228. CheckStatus:
  229.  
  230.     moveStatus = 0;
  231.     totemstatus = 0;
  232.     if (totem0 >= 0)
  233.     {
  234.         moveStatus = moveStatus + IsThingMoving(totem0);
  235.         totemstatus = totemstatus + GetCurFrame(totem0);
  236.     }
  237.  
  238.     return;
  239.  
  240.  
  241. # ..............................................................................
  242.  
  243. pulse:
  244.  
  245.     if (shake == 3)
  246.     {
  247.         vibe = RandBetween(1, 3);
  248.         if (vibe == 3)
  249.         {
  250.             # Skip this time...
  251.             return;
  252.         }
  253.     }
  254.  
  255.     vibe = RandBetween(1, 4);
  256.     if (vibe == 1)
  257.     {
  258.         if (shake == 1)
  259.         {
  260.             posOffset = '-0.005 0.00 -0.001'; #1 
  261.             angOffset = '0.00 -0.001 0.001';
  262.         }
  263.         if (shake == 2)
  264.         {
  265.             posOffset = '0.01 -0.01 0.005'; #2
  266.             angOffset = '0.005 0.00 -0.005';
  267.         }
  268.         if (shake == 3)
  269.         {
  270.             posOffset = '0.01 0.02 -0.02'; #3
  271.             angOffset = '-0.01 0.01 -0.01';
  272.         }
  273.     }
  274.     if (vibe == 2)
  275.     {
  276.         if (shake == 1)
  277.         {
  278.             posOffset = '0.005 -0.002 0.001'; #2 was .005x
  279.             angOffset = '0.001 0.00 -0.001';
  280.         }
  281.         if (shake == 2)
  282.         {
  283.             posOffset = '0.005 0.01 -0.01'; #3
  284.             angOffset = '-0.005 0.005 -0.00';
  285.         }
  286.         if (shake == 3)
  287.         {
  288.             posOffset = '-0.02 0.00 0.02'; #4
  289.             angOffset = '0.00 0.00 0.01';
  290.         }
  291.     }
  292.     if (vibe == 3)
  293.     {
  294.         if (shake == 1)
  295.         {
  296.             posOffset = '0.002 0.002 -0.002'; #3
  297.             angOffset = '-0.001 0.002 -0.002';
  298.         }
  299.         if (shake == 2)
  300.         {
  301.             posOffset = '-0.015 0.00 0.01'; #4 was .01x
  302.             angOffset = '0.00 0.00 0.01';
  303.         }
  304.         if (shake == 3)
  305.         {
  306.             posOffset = '-0.025 0.00 -0.01'; #1 was .02x
  307.             angOffset = '0.00 -0.01 0.01';
  308.         }
  309.     }
  310.     if (vibe == 4)
  311.     {
  312.         if (shake == 1)
  313.         {
  314.             posOffset = '-0.001 0.00 0.002'; #4
  315.             angOffset = '0.00 0.00 0.001';
  316.         }
  317.         if (shake == 2)
  318.         {
  319.             posOffset = '-0.01 0.00 -0.005'; #1
  320.             angOffset = '0.00 -0.005 0.005';
  321.         }
  322.         if (shake == 3)
  323.         {
  324.             posOffset = '0.02 -0.02 0.01'; #2
  325.             angOffset = '0.01 0.00 -0.01';
  326.         }
  327.     }
  328.  
  329.     vibe = RandBetween(1, 3);
  330.     if (vibe == 1)
  331.     {
  332.         SetPulse(0.05);
  333.     }
  334.     if (vibe == 2)
  335.     {
  336.         SetPulse(0.1);
  337.     }
  338.     if (vibe == 3)
  339.     {
  340.         SetPulse(0.15);
  341.     }
  342.  
  343.     SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  344.  
  345.     return;
  346.  
  347. end
  348.  
  349.